package com.pan.kang.model.vo;




import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import java.io.Serializable;

@JsonInclude(Include.NON_EMPTY)
public class BaseResponseVO<T> implements Serializable {
    public static final String CODE_SUCCESS = "6100000";
    public static final String MSG_SUCCESS = "success";
    public static final String CODE_FAILS = "6825499";
    private static final long serialVersionUID = 1L;
    private String code;
    private String message;
    private T data;

    public BaseResponseVO(String code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public BaseResponseVO(T data) {
        this.code = "6100000";
        this.data = data;
        this.message = "success";
    }

    public BaseResponseVO() {
    }

    public static BaseResponseVO success(String newMassage) {
        return (new BaseResponseVO()).setCode("6100000").setMessage(newMassage);
    }

    public static BaseResponseVO success() {
        return (new BaseResponseVO()).setCode("6100000").setMessage("success");
    }

    public static <T> BaseResponseVO<T> success(T data) {
        return (new BaseResponseVO()).setCode("6100000").setMessage("success").setData(data);
    }

    public static <T> BaseResponseVO<T> success(T data, String newMassage) {
        return (new BaseResponseVO()).setCode("6100000").setMessage(newMassage).setData(data);
    }

    public static BaseResponseVO fails(String newMassage) {
        return (new BaseResponseVO()).setCode("6825499").setMessage(newMassage);
    }

    public static BaseResponseVO fails() {
        return (new BaseResponseVO()).setCode("6825499");
    }

    public static <T> BaseResponseVO<T> of(T value) {
        return new BaseResponseVO(value);
    }

    public static <T> BaseResponseVO<T> of(T value, String code, String message) {
        return new BaseResponseVO(code, value, message);
    }

    public String getCode() {
        return this.code;
    }

    public BaseResponseVO<T> setCode(String newCode) {
        this.code = newCode;
        return this;
    }

    public String getMessage() {
        return this.message;
    }

    public BaseResponseVO<T> setMessage(String newMessage) {
        this.message = newMessage;
        return this;
    }

    public Object getData() {
        return this.data;
    }

    public BaseResponseVO<T> setData(T newData) {
        this.data = newData;
        return this;
    }
}

